/*
 * Copyright (c) 2002-2004, xRhino, Inc.
 *
 * This library is free software; you can redistribute and/or modify
 * it under the terms of the dual license distributed with this source
 * package (a combined Trolltech QPL/GPL-compatible license)
 *
 * Under this dual license scheme, a separate license is available for use of 
 * this code with a proprietary (closed) system. For more information on the 
 * license, please see the LICENSE file distributed with this source package.
 */
#ifndef SUGTRANSFORM_H
#define SUGTRANSFORM_H

#include "SugTypes.h"

/**
 * SugTranform stores a single transformation as given by an element's
 * tranform attribute.
 */
class SugTransform
{
  protected:
   /**
    * The type of transform this is.
    */
   SugTypes::TransformType mType;

   /**
    * The x value of the transform.
    */
   SugRealType mX;

   /**
    * The y value of the transform.
    */
   SugRealType mY;

   /**
    * The transformation angle.
    */
   SugRealType mAngle;

  public:
   /**
    * Sets the transformation matrix.
    */
   //void setMatrix(SugMatrix& matrix);

   /**
    * Parses the given string and sets itself up with the correct
    * data. The string can have the following formats:
    *   matrix(a, b, c, d, e, f)
    *   translate(x, [y])
    *   scale(x, [y])
    *   rotate(angle, [x, y])
    *   skewX(angle)
    *   skewY(angle)
    *
    * @params transformString The string to parse.
    */
   void setTransform(const char* transformString);
   
   /**
    * Sets the translation x and y.
    *
    * @param x The X amount to translate.
    * @param y The Y amount to translate.
    */
   void setTranslate(SugRealType x, SugRealType y);

   /**
    * Sets the scale x and y.
    *
    * @param x The X factor to scale by.
    * @param y The Y factor to scale by.
    */
   void setScale(SugRealType x, SugRealType y);

   /**
    * Sets the rotation angle, x and y.
    *
    * @param angle The angle to rotate by.
    * @param x The X coordinate to rotate around.
    * @param y The Y coordinate to rotate around.
    */
   void setRotate(SugRealType angle, SugRealType x, SugRealType y);

   /**
    * Sets the skew x angle.
    *
    * @param angle The angle to skew by.
    */
   void setSkewX(SugRealType angle);

   /**
    * Sets the skew y angle.
    *
    * @param angle The angle to skew by.
    */
   void setSkewY(SugRealType angle);

   /**
    * Returns the X value of this transform.
    *
    * @returns The X value.
    */
   SugRealType getX();
   
   /**
    * Returns the Y value of this transform.
    *
    * @returns The Y value.
    */
   SugRealType getY();
   
   /**
    * Returns the angle value of this transform.
    *
    * @returns The angle value.
    */
   SugRealType getAngle();

   /**
    * Returns the type of this transform.
    *
    * @returns The transform type.
    */
   SugTypes::TransformType getType();   
   
   /**
    * The class constructor.
    */
   SugTransform();

   /**
    * The class destructor.
    */
   ~SugTransform();
};

#endif
